home *** CD-ROM | disk | FTP | other *** search
-
- /*=======================================================================*/
- /* */
- /* (c) InstallShield Software Corporation (1996-1997) */
- /* (c) InstallShield Corporation (1990-1996) */
- /* Schaumburg, Illinois 60173 */
- /* All Rights Reserved */
- /* InstallShield (R) */
- /* */
- /* File : sdsfdr.rul */
- /* */
- /* Purpose : This file contains the code for the SdSelectFolder */
- /* script dialog function. */
- /* */
- /*=======================================================================*/
-
- /*------------------------------------------------------------------------*/
- /* */
- /* Function: SdSelectFolder */
- /* */
- /* Descrip: This dialog will let user choose which group/folder */
- /* the software should belong to. */
- /* Misc: */
- /* */
- /*------------------------------------------------------------------------*/
- function SdSelectFolder( szTitle, szMsg, svDefGroup )
- STRING szDlg, szTemp, szGroup, szStr_InvalidFolder, szStr_InvalidFdr_Title;
- NUMBER nId, nMessage, nTemp, nOS, hIsres;
- HWND hwndDlg, hwndEdit;
- BOOL bDone;
- begin
-
- Enable(HOURGLASS);
- szDlg = SD_DLG_SELECTFOLDER;
- nSdDialog = SD_NDLG_SELECTFOLDER;
-
- // record data produced by this dialog
- if (MODE=SILENTMODE) then
- SdMakeName( szAppKey, szDlg, szTitle, nSdSelectFolder );
- SilentReadData( szAppKey, "Result", DATA_NUMBER, szTemp, nId );
- if ((nId != BACK) && (nId != CANCEL)) then
- SilentReadData( szAppKey, "szFolder", DATA_STRING, svDefGroup, nTemp );
- endif;
- Disable(HOURGLASS);
- return nId;
- endif;
-
-
- // ensure general initialization is complete
- if (!bSdInit) then
- SdInit();
- endif;
-
- if (EzDefineDialog( szDlg, "", "", SD_NDLG_SELECTFOLDER ) = DLG_ERR) then
- Disable(HOURGLASS);
- return -1;
- endif;
-
- // Loop in dialog until the user selects a standard button
- bDone = FALSE;
-
- while (!bDone)
-
- nId = WaitOnDialog( szDlg );
- switch(nId)
- case DLG_INIT:
- if( szMsg != "" ) then
- SdSetStatic(szDlg, SD_STA_MSG, szMsg);
- endif;
-
- szGroup = svDefGroup;
-
- CtrlSetText( szDlg, SD_EDIT_PROGGRP, szGroup );
- CtrlPGroups( szDlg, SD_LIST_EXISTGRP );
- CtrlSetCurSel( szDlg, SD_LIST_EXISTGRP, szGroup );
-
- hwndDlg = CmdGetHwndDlg( szDlg );
- SdGeneralInit( szDlg, hwndDlg, STYLE_BOLD, szSdProduct );
-
- if(szTitle != "") then
- SetWindowText(hwndDlg, szTitle);
- endif;
-
- Disable(HOURGLASS);
-
- case SD_LIST_EXISTGRP:
- CtrlGetCurSel(szDlg, SD_LIST_EXISTGRP, szGroup );
- CtrlSetText(szDlg, SD_EDIT_PROGGRP, szGroup );
-
- case NEXT:
- CtrlGetText(szDlg, SD_EDIT_PROGGRP, szGroup );
- SdRemoveEndSpace( szGroup );
-
- if (szGroup = "") then // don't allow null group names
- MessageBeep(0);
- hwndEdit = GetDlgItem( hwndDlg, SD_EDIT_PROGGRP );
- SetFocus( hwndEdit );
- // don't allow illegal characters (\/:*?"<>|)
- elseif ((szGroup % "/") ||
- (szGroup % ":") ||
- (szGroup % "*") ||
- (szGroup % "?") ||
- (szGroup % "\"") ||
- (szGroup % "<") ||
- (szGroup % ">") ||
- (szGroup % "|") && SdIsShellExplorer() ) then
- MessageBeep(0);
- // Load String
- hIsres = GetModuleHandle( ISRES );
- if (hIsres) then
- LoadString( hIsres, SD_STR_INVALID_FOLDER_TITLE, szStr_InvalidFdr_Title, _MAX_STRING );
- LoadString( hIsres, SD_STR_INVALID_FOLDER, szStr_InvalidFolder, _MAX_STRING );
- endif;
- SetDialogTitle(DLG_MSG_SEVERE, szStr_InvalidFdr_Title);
- MessageBox(szStr_InvalidFolder+ "\n\n\t "+ "/ : * ? \" < > |", SEVERE);
- SetDialogTitle(DLG_MSG_SEVERE, "Severe");
- hwndEdit = GetDlgItem( hwndDlg, SD_EDIT_PROGGRP );
- SetFocus( hwndEdit );
- else
- svDefGroup = szGroup;
- nId = NEXT;
- bDone = TRUE;
- endif;
-
- case BACK:
- nId = BACK;
- bDone = TRUE;
-
- case DLG_ERR:
- SdError( -1, "SdSelectFolder" );
- nId = -1;
- bDone = TRUE;
-
- case DLG_CLOSE:
- SdCloseDlg( hwndDlg, nId, bDone );
-
- default:
- // check standard handling
- if (SdIsStdButton( nId ) && SdDoStdButton( nId )) then
- bDone = TRUE;
- endif;
- endswitch;
-
- endwhile;
-
- EndDialog( szDlg );
- ReleaseDialog( szDlg );
-
- SdUnInit( );
- Disable(HOURGLASS);
-
- // record data produced by this dialog
- SdMakeName( szAppKey, szDlg, szTitle, nSdSelectFolder );
- SilentWriteData( szAppKey, "szFolder", DATA_STRING, svDefGroup, 0 );
- SilentWriteData( szAppKey, "Result", DATA_NUMBER, "", nId );
-
- return nId;
-
- end;
-